package com.pb.news.util;

public class PageSupport {
	// 总页数
	public int totalPageCount = 1;
	// 总记录数
	public int totalCount = 0;
	// 当前页码
	public int currentPageNo = 1;
	// 总页面容量
	public int pageSize = 0;
	
	public int getTotalPageCount() {
		return totalPageCount;
	}
	public void setTotalPageCount(int totalPageCount) {
		this.totalPageCount = totalPageCount;
	}
	public int getTotalCount() {
		return totalCount;
	}
	public void setTotalCount(int totalCount) {
		if(totalCount > 0){
			this.totalCount = totalCount;
			// 设置总页数
			setTotalPageCountByRs();
		}
	}
	public int getCurrentPageNo() {
		return currentPageNo;
	}
	public void setCurrentPageNo(int currentPageNo) {
		if(currentPageNo > 0){
			this.currentPageNo = currentPageNo;
		}
	}
	public int getPageSize() {
		return pageSize;
	}
	public void setPageSize(int pageSize) {
		if(pageSize > 0){
			this.pageSize = pageSize;
		}
	}
	
	public void setTotalPageCountByRs(){
		if(totalCount % pageSize == 0){
			totalPageCount = totalCount / pageSize;
		}else if (totalCount % pageSize > 0){
			totalPageCount = totalCount / pageSize + 1;
		}else{
			totalPageCount = 1;
		}
	}
	
}
